package com.system.manager.modules.authorized.controller;


import com.system.manager.common.annotation.PreAuthorize;
import com.system.manager.common.entity.Result;
import com.system.manager.modules.authorized.enums.SubjectType;
import com.system.manager.modules.authorized.service.IRoleMenuService;
import com.system.manager.modules.authorized.service.impl.RoleMenuServiceImpl;
import com.system.manager.modules.authorized.vo.RoleMenuVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yxp
 * @since 2021-10-18
 */
@Api(tags = "角色权限关联API")
@RestController
@RequestMapping("/authorized/")
public class RoleMenuController {

    @Autowired
    private IRoleMenuService roleMenuService;

    @ApiOperation("更新当前角色的权限")
    @PreAuthorize(SubjectType.ANONYMOUS)
    @PostMapping("update/roleMenusId")
    public Result updateRoleMenusId(@RequestBody RoleMenuVo roleMenuVo){

        roleMenuService.updateRoleMenusId(roleMenuVo);

        return Result.ok();
    }

}
